#!/usr/bin/env ruby
%x(svn up)

version = %x(svn info|grep "Revis").match(/\d\d\d?/).to_s

puts "Releasing version r" + version + "."

# Clean previous build
%x(rm HappyCoder*)
%x(rm -Rf HappyCoderInstaller.app)

# Build Package
%x(zip -D "HappyCoder-r#{version}.zip" "../Happy Coder.icns" "../Happy Coder.keylayout")
# %x(googlecode-upload.py --summary="HappyCoder-r#{version}.zip (solo mapa de teclado)" --project=happycoder --user=bomberstudios --password=h5g2m4w4 "HappyCoder-r#{version}.zip")

# Build installer
%x(/usr/local/bin/platypus -R -a 'HappyCoder' -t 'Ruby' -o 'TextWindow' -u 'Ale Munoz' -i '../Happy Coder.icns' -V '1.0-r#{version}' -s '????' -I 'com.sofanaranja.HappyCoder' -f '../Happy Coder.icns' -f '../Happy Coder.keylayout' -f 'open_system_prefs.applescript' 'install.rb' 'HappyCoderInstaller.app')
%x(zip -r "HappyCoder_Installer-r#{version}.zip" HappyCoderInstaller.app)
# %x(rm -Rf HappyCoderInstaller.app)
%x(googlecode-upload.py --summary="HappyCoder_Installer-r#{version}.zip" --project=happycoder --user=bomberstudios --password=h5g2m4w4 "HappyCoder_Installer-r#{version}.zip")
# %x(rm "HappyCoder_Installer-r#{version}.zip")